Methods: | |
---|---|
<Enter> | The mouse pointer entered the widget. |
<Leave> | The mouse pointer left the widget. |
<FocusIn> | Keyboard focus was moved to this widget. |
<FocusOut> | Keyboard focus was moved from this widget. |
from tkinter import * class MyFrame(Tk): def __init__(self): super().__init__() self.geometry("500x300") self.configure(bg="white") self.lbl=Label(self,text="CCIT",font="Arial 100 bold",bg="white") self.lbl.pack(padx=50,pady=50) self.lbl.bind("",self.OnEnter) self.lbl.bind(" ",self.OnLeave) def OnEnter(self,e): self.lbl.config(fg="red") def OnLeave(self,e): self.lbl.config(fg="black") frm=MyFrame() frm.mainloop()